BATTLE PROJECTILES AND EFFECTS
==============================

Every projectile (a fireball in flight) and one-shot effect (the burst
where it lands) is a PNG strip in this folder, loaded when a fight first
uses it. Replace a file to change one; add a file to add one. No rebuild
needed. They are display only: they never change what happens in a fight.

The art
-------
<id>.png is a row of frames side by side, left to right. Frames are square
(as wide as the strip is tall) unless the sidecar says otherwise. Draw a
projectile facing RIGHT: the game turns it to face where it flies and
mirrors it when it flies left, so it stays upright. The middle of a frame
is the point that travels and lands on the target's middle.

The battle draws 128 texture pixels per world unit, the same as the party
and enemy sprites, so a 16x16 strip is about the size of a party member's
head and body. Pixels are drawn sharp (no smoothing).

The shipped strips are drawn by Tools/effects/generate_effects.py:
    fireball, ice_shard, arrow, arcane_bolt, shadow_bolt, chaos_bolt,
    drain_orb, spark                       (projectiles)
    fire_burst, ice_burst, magic_burst, dark_burst, spark_burst  (impacts)

The sidecar
-----------
An optional <id>.json beside the PNG sets its defaults. Every field is
optional:

    {
        "frameWidth": 16,     pixels per frame; 0 or missing = square
        "fps": 12,            frames per second at 1x battle speed
        "pixelsPerUnit": 128,
        "rotate": true,       turn to face the flight (projectiles)
        "duration": 0.5,      flight seconds at 1x battle speed
        "arc": 0,             how high the path bows mid-flight
        "spin": 0,            degrees per second of tumble (thrown blades)
        "scale": 1,
        "impact": "fire_burst"   effect played where it lands
    }

Times follow the battle speed option: at 2x everything takes half as long.

From Lua
--------
helper.lua has four calls. "targets" is one unit, ctx:getChosenTargets(),
or a table of units.

    -- Fly a fireball at every target and wait until the last one lands,
    -- so the hit that follows lands with it:
    helper.waitForProjectile(caster, targets, "fireball")
    helper.hitAttempt(ctx, power, HIT, caster, targets)

    -- The same without waiting; returns the seconds until it lands:
    local t = helper.launchProjectile(target, caster, "drain_orb")

    -- A one-shot effect on a unit (wait for it, or not):
    helper.waitForEffect(unit, "magic_burst")
    helper.playEffect(unit, "fire_burst", { scale = 2 })

Projectile options (override the sidecar for one shot):
    duration     flight seconds at 1x
    arc          path height at mid-flight (0.1 is a gentle lob)
    scale        multiplies the art's size
    rotate       false: never turn
    spin         degrees per second of tumble
    stagger      seconds between launches when it flies at several targets
    impact       an effect id to play where it lands, or false for none
    impactScale  multiplies the impact's size
    startOffset  { x, y }: launch point, x forward along the flight, y up
    endOffset    { x, y }: landing point, the same way
    tint         { r, g, b } multiplied into the art and its impact (0..1)

    helper.waitForProjectile(caster, targets, "arrow", { arc = 0.15, stagger = 0.1 })
    helper.waitForProjectile(caster, target, "fireball", { scale = 2, impact = "dark_burst" })

Effect options: scale, tint, offset { x, y } (from the unit's middle, +x
toward the party's side, +y up), loops (times to play it through), flip.

A missing id is logged once and shows nothing; the calls then don't wait.
